package norbert.flickr.controls {
	import mx.controls.Image;
	import norbert.flickr.api.Url;
	import mx.logging.ILogger;
	import mx.logging.Log;
	import flash.utils.getQualifiedClassName;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import mx.managers.PopUpManager;

	public class PhotoSetImage extends Image {
		private static var logger: ILogger = Log.getLogger("norbert.flickr.controls.PhotoSetImage");
		
		/* PROPERTIES */
		
		private var _size: String = null;
		[Bindable]
		[Inspectable(category="General", enumeration="s,t,m,b")]
		public function get size(): String {
			return _size;
		}
		public function set size(value: String): void {
			_size = value;
			invalidateProperties();
		}
		
		private var _photoSet: XML = null;
		[Bindable]
		public function get photoSet(): XML {
			return _photoSet;
		}
		public function set photoSet(value: XML): void {
			_photoSet = value;
			invalidateProperties();
		}
		
		/* CONSTRUCTOR */
		
		public function PhotoSetImage() {
		}
		
		/* EVENT HANDLERS */
		
		/* METHODS */
		
		override protected function commitProperties(): void {
			super.commitProperties();
			
			if (photoSet != null && size != null && size != "") {
				source = Url.getPhotoSetSourceUrl(photoSet, size);
			}
		}
	}
}
